#ifndef PLOT_H
#define PLOT_H

#include <QWidget>
#include <QTimer>
#include <QTime>
#include <vector>
#include "qcustomplot.h"
#include "minIni.h"
#include <string>
#include <sstream>
#include <iostream>
#include <QCheckBox>

using namespace std;

namespace Ui {
class Plot;
}

#define MAX_PAGE 2

class Plot : public QWidget
{
    Q_OBJECT

public:
    explicit Plot(QWidget *parent = 0);
    ~Plot();
    void setupPlot();

private:
    Ui::Plot *ui;
    bool status;
    double xTimeScale;
    double timeBase;
    long int pointNum;
    QTimer *dataTimer;
    QTime *sysTime;
    minIni *iniFile;
    vector<string> graghName;
    vector<double> graghOffset;
    vector<double> graghScale;
    QCheckBox *checkBoxGragh;

private slots:
    void horzScrollBarChanged(int value);
    void xAxisChanged(QCPRange range);
    void xTimeScaleChange();
    void autoGenerateData();
    void realtimeDataSlot(vector<double> &v);
    void startPaint(void);
    void clearPaint(void);
    void savePlotFile(void);
    void openPlotFile(void);
    void setGraghVisible(bool);
};

#endif // PLOT_H
